Conversation
There was a problem hiding this comment.
Pull request overview
This pull request extends ruff linting configuration and applies automatic fixes across the codebase to improve code quality and consistency. The changes include adding comprehensive ruff rules in pyproject.toml, converting unittest assertions to plain assert statements, adding type hints to function signatures, updating docstrings to single-line format, and modernizing file I/O operations using pathlib.
Changes:
- Added comprehensive ruff linting configuration with selective rule ignoring
- Converted unittest-style assertions (assertEqual, assertTrue, assertRaises) to pytest-style assertions throughout test files
- Added return type hints (-> None) to functions across test files, source files, and examples
- Modernized file operations using pathlib instead of open() with context managers
- Updated docstrings from multi-line to single-line format where appropriate
Reviewed changes
Copilot reviewed 46 out of 46 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Added comprehensive ruff linting configuration with rules and per-file ignores |
| test/test_worker.py | Added type hints and converted assertions to pytest style |
| test/test_unicode_surrogates.py | Added type hints and converted assertions to pytest style |
| test/test_smsd.py | Migrated from unittest.SkipTest to pytest.skip, added type hints, modernized file I/O |
| test/test_sms.py | Added type hints and converted assertions to pytest style |
| test/test_errors.py | Added NoReturn type hint, converted to pytest.raises, removed exception instantiation |
| test/test_dummy.py | Added type hints, converted assertions, modernized file I/O with pathlib |
| test/test_data.py | Added type hints and converted assertions to pytest style |
| test/test_config.py | Added type hints, converted assertions, modernized file I/O with pathlib |
| test/test_backup.py | Added type hints and converted assertions to pytest style |
| test/test_asyncworker.py | Added type hints, converted to pytest.raises, improved async termination logic |
| setup.py | Added type hints, added noqa comments for security warnings, improved code structure |
| gammu/worker.py | Added type hints and simplified docstrings to single-line format |
| gammu/smsd.py | Simplified module docstring to single-line format |
| gammu/exception.py | Simplified module docstring and added noqa comment |
| gammu/data.py | Alphabetically sorted all exports |
| gammu/asyncworker.py | Added copyright header, type hints, improved termination with asyncio.to_thread |
| gammu/init.py | Simplified module docstring to single-line format |
| examples/*.py | Added type hints, improved docstrings, refactored code for better maintainability |
Comments suppressed due to low confidence (1)
setup.py:51
- The
check_pkconfigmethod can returnNoneimplicitly when no exception is caught and no explicit return is executed, but the type hint indicates it returnsbool | None. The function should have an explicitreturn Nonestatement at the end for clarity, or the logic should be restructured to ensure all paths return a boolean value explicitly.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def error_function(): | ||
| raise gammu.exception.ERR_WRONGCRC() | ||
| def error_function() -> NoReturn: | ||
| raise gammu.exception.ERR_WRONGCRC |
There was a problem hiding this comment.
The change from raise gammu.exception.ERR_WRONGCRC() to raise gammu.exception.ERR_WRONGCRC removes the function call parentheses. This changes the behavior - if ERR_WRONGCRC is a class, it should be instantiated with parentheses. Please verify that ERR_WRONGCRC is intended to be raised as-is without instantiation.
No description provided.